import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import java.net.*;
import java.applet.*;
import java.awt.image.*;
import java.io.*;
import javax.imageio.*;

public class GameStatusBar extends JPanel{
	
	private Player playa;
	private BufferedImage hpbar;
	private BufferedImage manabar;
	private BufferedImage bar;
	private Boolean rdy;
	private int mratio;
	private int hratio;
	
    public GameStatusBar(Player playa) {
    	rdy = false;
    	hratio = playa.getHP() / playa.getMaxHP();
    	mratio = playa.getMP() / playa.getMaxMP();
   
    	
    	try{
	    	hpbar = ImageIO.read(new File("Assets\\misc\\hpbar.gif"));
	    	manabar = ImageIO.read(new File("Assets\\misc\\mpbar.gif"));
	    	bar = ImageIO.read(new File("Assets\\misc\\statusbar.png"));
    	}catch(Exception e){}
    	
    	rdy = true;
    }
    
    public void paint(Graphics g){
	    if (rdy == true){
	    	g.drawImage(bar,0,600,600,100,this);
	    	g.drawImage(hpbar,10,615,120*hratio,30,this);
	    	g.drawRect(10,615,120,30);
	    	g.drawImage(manabar,10,655,120*mratio,30,this);
	    	g.drawRect(10,655,120,30);
	    }
    }
    
}